<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateCommodityActivitySkuTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('commodity_activity_sku', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('commodity_id')->index()->comment('商品 ID');
            $table->bigInteger('commodity_activity_id')->index()->comment('商品活动 ID');
            $table->unsignedBigInteger('entry_price')->default(0)->comment('入仓价 (单位:分)');
            $table->unsignedBigInteger('purchase_price')->default(0)->comment('进价 (单位:分)');
            $table->unsignedBigInteger('strongman_price')->default(0)->comment('大咖价 (单位:分)');
            $table->unsignedBigInteger('elite_price')->default(0)->comment('精英价 (单位:分)');
            $table->unsignedBigInteger('group_owner_price')->default(0)->comment('群主价 (单位:分)');
            $table->unsignedBigInteger('external_guide_price')->default(0)->comment('对外指导价 (单位:分)');
            $table->unsignedBigInteger('direct_invitation')->default(0)->comment('直接邀请奖励 (单位:分)');
            $table->unsignedBigInteger('indirect_invitation')->default(0)->comment('间接邀请奖励 (单位:分)');
            $table->unsignedBigInteger('stock')->default(0)->comment('库存 (根据销量会改变)');
            $table->unsignedBigInteger('original_stock')->default(0)->comment('原始库存 (一开始时候的库存)');
            $table->unsignedBigInteger('estimated_sales')->default(0)->comment('预计销量');
            $table->unsignedBigInteger('sales')->default(0)->comment('实际销量');
            $table->unsignedBigInteger('shipment')->default(0)->comment('发货量');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('commodity_activity_sku');
    }
}
